import { onMounted, ref } from "vue";
import { getArticlesList } from "@/api/learn/articles";

export function useWelcome() {
  const articleList = ref([]);

  onMounted(async () => {
    const { data } = await getArticlesList();
    articleList.value = data.lists.map(item => {
      return {
        id: item.id,
        title: item.title,
        createdAt: item.createdAt
      };
    });
  });

  return {
    articleList
  };
}
